# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=cycler
pkgbase=mingw-w64-python-${_realname}
pkgname=(
  "${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
  "${MINGW_PACKAGE_PREFIX}-python2-${_realname}"
)
pkgver=0.9.0
pkgrel=1
pkgdesc="Composable style cycles"
arch=('any')
license=('BSD')
url="https://github.com/matplotlib/cycler"
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
  "${MINGW_PACKAGE_PREFIX}-python3-six"
  "${MINGW_PACKAGE_PREFIX}-python2-six"
  'git'
)
checkdepends=(
  "${MINGW_PACKAGE_PREFIX}-python3-nose"
  "${MINGW_PACKAGE_PREFIX}-python2-nose"
  "${MINGW_PACKAGE_PREFIX}-python3-coverage"
  "${MINGW_PACKAGE_PREFIX}-python2-coverage"
)
source=("git+https://github.com/matplotlib/cycler.git#tag=v$pkgver")
sha512sums=('SKIP')

prepare() {
  cp -a cycler{,-py2}
}

build() {
  cd $srcdir/cycler
  python3 setup.py build

  cd $srcdir/cycler-py2
  python2 setup.py build
}

check() {
  cd $srcdir/cycler
  python3 run_tests.py

  cd $srcdir/cycler-py2
  python2 run_tests.py
}

package_python3-cycler() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python3>=3.5.0" "${MINGW_PACKAGE_PREFIX}-python3<3.6.0"
    "${MINGW_PACKAGE_PREFIX}-python3-six"
  )

  cd cycler
  python3 setup.py install --root="${pkgdir}" --prefix=/$MINGW_PREFIX --optimize=1
  install -D -m644 LICENSE "${pkgdir}/$MINGW_PREFIX/share/licenses/python3-cycler/LICENSE"
}

package_python2-cycler() {
  depends=(
    "${MINGW_PACKAGE_PREFIX}-python2>=2.7.0" "${MINGW_PACKAGE_PREFIX}-python2<2.8.0"
    "${MINGW_PACKAGE_PREFIX}-python2-six"
  )

  cd cycler-py2
  python2 setup.py install --root="${pkgdir}" --prefix=/$MINGW_PREFIX --optimize=1
  install -D -m644 LICENSE "${pkgdir}/$MINGW_PREFIX/share/licenses/python2-cycler/LICENSE"
}

package_mingw-w64-i686-python2-cycler() {
  package_python2-cycler
}

package_mingw-w64-i686-python3-cycler() {
  package_python3-cycler
}

package_mingw-w64-x86_64-python2-cycler() {
  package_python2-cycler
}

package_mingw-w64-x86_64-python3-cycler() {
  package_python3-cycler
}
